import request from '@/router/axios';

export const getRolesTree = (userId) => {
  return request({
    url: '/api/sellerRole/roleTreeListByUserId',
    method: 'post',
    params: {
      userId
    }
  })
}

export const setMenu = (data) => {
  return request({
    url: '/api/sellerRole/setAuthority',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      ...data
    }
  })
}
export const getListdata = (page, size, params) => {
  return request({
    url: '/api/sellerRole/list',
    method: 'post',
    params: {
      ...params,
      page,
      size,
    }
  })
}
export const remove = (roleId) => {
  return request({
    url: '/api/sellerRole/remove',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      roleId,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/sellerRole/add',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/sellerRole/edit',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: row
  })
}

export const getRole = (roleId) => {
  return request({
    url: '/api/sellerRole/view',
    method: 'post',
    params: {
      roleId
    }
  })
}